Skip to content

Instantly share code, notes, and snippets.

@acarril
acarril / bootable-win-on-mac.md
Created November 18, 2022 17:49
Create a bootable Windows USB using macOS

For some reason, it is surprisingly hard to create a bootable Windows USB using macOS. These are my steps for doing so, which have worked for me in macOS Monterey (12.6.1) for Windows 10 and 11. After following these steps, you should have a bootable Windows USB drive.

1. Download a Windows disc image (i.e. ISO file)

You can download Windows 10 or Windows 11 directly from Microsoft.

2. Identify your USB drive

After plugging the drive to your machine, identify the name of the USB device using diskutil list, which should return an output like the one below. In my case, the correct disk name is disk2.

/*
TaskManagerSecret
Author: @splinter_code
This is a very ugly POC for a very unreliable UAC bypass through some UI hacks.
The core of this hack is stealing and using a token containing the UIAccess flag set.
A trick described by James Forshaw, so all credits to him --> https://www.tiraniddo.dev/2019/02/accessing-access-tokens-for-uiaccess.html
From there it uses a task manager "feature" to run a new High IL cmd.exe.
This has been developed only for fun and shouldn't be used due to its high unreliability.
/*
Task Description
interval_map<K,V> is a data structure that efficiently associates intervals of keys of type K with values of type V. Your task is to implement the assign member function of this data structure, which is outlined below.
interval_map<K, V> is implemented on top of std::map. In case you are not entirely sure which functions std::map provides, what they do and which guarantees they provide, we provide an excerpt of the C++ standard here:
Each key-value-pair (k,v) in the std::map means that the value v is associated with the interval from k (including) to the next key (excluding) in the std::map.
Example: the std::map (0,'A'), (3,'B'), (5,'A') represents the mapping
@paulirish
paulirish / what-forces-layout.md
Last active May 11, 2024 20:51
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@wxllow
wxllow / useragent-switcher-preferences(1).json
Created May 11, 2024 20:51
useragent-switcher-preferences for AARCH64/ARM64 Linux (Asahi)
{
"blacklist": [],
"cache": true,
"custom": {
"netflix.com": "Mozilla/5.0 (X11; CrOS x86_64 15633.69.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.6045.212 Safari/537.36"
},
"exactMatch": false,
"faqs": false,
"last-update": 1714282750222,
"log": false,
/**
* @category models
* @since 1.0.0
*/
export interface SqliteClient extends Client.Client {
readonly [TypeId]: typeof TypeId
readonly config: SqliteClientConfig
/** Not supported in d1 */
@arekmaz
arekmaz / drizzle-effect-schema.ts
Last active May 11, 2024 20:50
drizzle-effect-schema
import * as S from "@effect/schema/Schema";
import { Assume, Column, Equal, Table, getTableColumns, is } from "drizzle-orm";
import {
MySqlChar,
MySqlVarBinary,
MySqlVarChar,
} from "drizzle-orm/mysql-core";
import { PgArray, PgChar, PgUUID, PgVarchar } from "drizzle-orm/pg-core";
import { SQLiteText } from "drizzle-orm/sqlite-core";
import { Simplify } from "effect/Types";
@omayib
omayib / SimpleRepositoryPatternIn.swift
Created August 29, 2017 07:53
Introducing repository pattern with swift.
//: Playground - noun: a place where people can play
import UIKit
class Todo{
var tempId: UUID?
var id : Int
var title: String
var isCompleted: Bool
@danielgross
danielgross / mathpix2gpt.py
Last active May 11, 2024 20:48
mathpix2gpt.py
import requests
import time
import os
import sys
import openai
import tiktoken
from termcolor import colored
openai.api_key = open(os.path.expanduser('~/.openai')).read().strip()